/*
 * Copyright (c) 2024 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef _INTERFACE_I2C_MUX_H_
#define _INTERFACE_I2C_MUX_H_

#include "internal/bus/bus_base/bus.h"
#include <device_tree/interface/Bus/I2cMux.h>
#include <mc/engine.h>

namespace dev {

// I2C MUX 默认值常量
constexpr uint8_t  I2C_MUX_DEFAULT_ID            = 0;
constexpr uint32_t I2C_MUX_DEFAULT_SPEED         = 400;
constexpr uint8_t  I2C_MUX_DEFAULT_MODE          = 0;
constexpr uint32_t I2C_MUX_DEFAULT_MUX_ADDRESS   = 0x70;
constexpr uint8_t  I2C_MUX_DEFAULT_CHANNEL_COUNT = 8;

class Interface_I2cMux : public mc::engine::interface<Interface_I2cMux, gen::I2cMux> {
public:
    Interface_I2cMux()  = default;
    ~Interface_I2cMux() = default;

    // 从variant中加载配置到基类属性
    void from_variant(mc::mutable_dict& csr_object);

    bus_base* m_bus = nullptr;
};

} // namespace dev

#endif // _INTERFACE_I2C_MUX_H_